{% extends "base.html" %}

{% block title %}优惠券 {{ coupon['name'] }}{% end %}

{% block head %}
    <script id="scriptInit" type="text/javascript">
        $(document).ready(function () {
            $("#tabs").wijtabs();
            $("#used").wijgrid();
            $("#unused").wijgrid();
            
    });
    </script>
{% end %}

{% block content %}

    <div id="tabs">
        <div id="tabs">
            <ul>
                <li><a href="#tabs-1">未领取</a></li>
                <li><a href="#tabs-2">已领取</a></li>
                <li><a href="#tabs-3">未领取可拷贝</a></li>
            </ul>
    
            <div id="tabs-1">
                <table id="unused">
                    <thead>
                        <tr>
                            <th>代码</th>
                            <th>截至日期</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for u in unused %}
                        <tr>
                            <td>{{ u['uid'] }}</td>
                            <td>{{ u.get('applied_date', '无') }}</td>
                        </tr>
                        {% end %}
                    </tbody>
                </table>
            </div>
    
            <div id="tabs-2">
                <table id="used">
                    <thead>
                        <tr>
                            <th>代码</th>
                            <th>领取日期</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for u in used %}
                        <tr>
                            <td>{{ u['uid'] }}</td>
                            <td>{{ u['valid'] }}</td>
                        </tr>
                        {% end %}
                    </tbody>
                </table>
            </div>
            <div id="tabs-3">
                {% for u in unused %}
                    <div>{{ u['uid'] }}</div>
                {% end %}
            </div>
        </div>
    </div>

{% end %}